package com.huawei.appmarket.service.appdetail.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ToggleButton;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSViewProxy;
import com.huawei.appgallery.foundation.ui.css.RenderListener;
import com.huawei.appgallery.foundation.ui.css.adapter.CSSPropertyName;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSMonoColor;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;
import o.epo;
import o.ewm.e;

public class RenderToggleButton extends ToggleButton implements RenderListener {
    public RenderToggleButton(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    public RenderToggleButton(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public RenderToggleButton(Context context) {
        super(context);
    }

    public boolean onRenderReady(CSSViewProxy cSSViewProxy) {
        CSSRule rule = cSSViewProxy.getRule();
        if (rule.getStyleDeclaration() == null) {
            return false;
        }
        CSSValue propertyValue = rule.getStyleDeclaration().getPropertyValue(CSSPropertyName.FONT_COLOR);
        if (propertyValue == null || !(propertyValue instanceof CSSMonoColor)) {
            return false;
        }
        setBackground(epo.ॱ(getContext().getResources().getDrawable(e.ˉ), ((CSSMonoColor) propertyValue).getColor()));
        return true;
    }
}
